﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/Adminitrator.master" AutoEventWireup="true" CodeFile="List.aspx.cs" Inherits="admin_Products_List" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Content" Runat="Server">
   <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
     <asp:UpdatePanel ID="UpdatePanel1" runat="server">
      <ContentTemplate>     
  <h1 class="title">
    Danh sách sản phẩm</h1>
  <div class="search">
    <fieldset class="fieldset">
      <legend>Lọc hiển thị</legend>
      <table>
        <tr>
          <td>
            <label>Danh mục</label>
            <asp:DropDownList ID="dropParent" runat="server" CssClass="dropDown" 
              AutoPostBack="True" onselectedindexchanged="dropParent_SelectedIndexChanged" Width="150px" />
          </td>
          <td style="padding-left: 20px">
            <label>Tình trạng</label>
             <asp:DropDownList ID="dropIsEnable" runat="server" CssClass="dropDown" 
              Width="100px" AutoPostBack="True" 
              onselectedindexchanged="dropIsEnable_SelectedIndexChanged" >
               <asp:ListItem Value="0">Tất cả</asp:ListItem>
               <asp:ListItem Value="1">Bật</asp:ListItem>
               <asp:ListItem Value="2">Tắt</asp:ListItem>
            </asp:DropDownList>
          </td>
        </tr>
      </table>
     </fieldset>
    </div><!-- End #search -->
    <div id="gridview">
     <asp:GridView ID="gridView" CssClass="tstyle1" runat="server" AutoGenerateColumns="False"
      CellPadding="3" EnableModelValidation="True" GridLines="None" AllowPaging="True"
      BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellSpacing="1"
      OnRowDataBound="gridView_RowDataBound" OnPageIndexChanging="gridView_PageIndexChanging"
      PageSize="8" OnRowDeleting="gridView_RowDeleting" EmptyDataText="Dữ liệu trống !">
      
      <SelectedRowStyle BackColor="#990000" Font-Bold="True" ForeColor="White" Font-Underline="True" />
        <Columns>
        <asp:TemplateField HeaderText="STT">
          <ItemTemplate>
            <%# Container.DataItemIndex + 1 %>
          </ItemTemplate>
          <ItemStyle Width="40px" />
        </asp:TemplateField>
          <asp:TemplateField HeaderText="Chọn">
            <ItemTemplate>
              <asp:CheckBox ID="checkBox" runat="server" />
            </ItemTemplate>
            <ItemStyle Width="45px" />
          </asp:TemplateField>
          <asp:BoundField DataField="Id" HeaderText="Mã">
          <ItemStyle Width="35px" />
          </asp:BoundField>
          <asp:BoundField DataField="Name" HeaderText="Tên sản phẩm">
          <ItemStyle Width="225px" />
          </asp:BoundField>
          <asp:BoundField DataField="CategoryId" HeaderText="Danh mục">
          <ItemStyle Width="120px" />
          </asp:BoundField>
          <asp:ImageField DataImageUrlField="Image_01" 
            DataImageUrlFormatString="~/Images/Product/thumb/{0}" HeaderText="Ảnh">
            <ControlStyle Height="30px" />
            <HeaderStyle HorizontalAlign="Center" />
            <ItemStyle HorizontalAlign="Center" Width="45px" />
          </asp:ImageField>
          
          <asp:BoundField DataField="View" HeaderText="Lượt xem">
          <ItemStyle Width="65px" />
          </asp:BoundField>
          
          <asp:TemplateField HeaderText="Tình trạng">
            <ItemTemplate>
              <asp:Image ID="imgStates" runat="server" />
            </ItemTemplate>
            <ItemStyle Width="80px" />
          </asp:TemplateField>
          
          <asp:HyperLinkField DataNavigateUrlFields="Id" 
            DataNavigateUrlFormatString="~/admin/Products/Details.aspx?Id={0}" 
            HeaderText="Sửa" >
          <ItemStyle CssClass="btnEdit" Width="30px" />
          </asp:HyperLinkField>
          <asp:TemplateField HeaderText="Xóa">
            <ItemTemplate>
              <asp:LinkButton ID="linkDelete" runat="server" CausesValidation="false" Text="" CssClass="btnDelete"
              CommandName="Delete" OnClientClick="return confirm('Bạn có chắc chắn muốn xóa ?')">
              </asp:LinkButton>
            </ItemTemplate>
            <ItemStyle Width="30px" />
          </asp:TemplateField>
        </Columns>
      </asp:GridView>
              <asp:UpdateProgress ID="UpdateProgress1" runat="server">
          <ProgressTemplate>
             <img src="../../Images/ajax-loader.gif" alt="Loadding" style="position: absolute; top: 50%; left: 50%; z-index: 1000" />
          </ProgressTemplate>
        </asp:UpdateProgress>
      </div>
      <div>
      <table style="width: 100%">
      <tr>
        <td align="left" valign="top">
          <asp:LinkButton ID="linkCheckAll" runat="server" Text="" CssClass="button btn-check"
          OnClick="linkCheckAll_Click" />&nbsp; &nbsp; &nbsp;
          <asp:LinkButton ID="linkUnCheckAll" runat="server" Text="" CssClass="button btn-uncheck"
          OnClick="linkUnCheckAll_Click" />
        </td>
        <td align="right">
             <asp:Button runat="server" ID="btnAdd" Text="" CssClass="button btn-add" 
            onclick="btnAdd_Click" />&nbsp;
        <asp:Button runat="server" ID="btnXoaChon" Text="" CssClass="button btn-delete" OnClientClick="return confirm('Bạn có chắc chắn muốn xóa ?')" OnClick="btnXoaChon_Click" />
        &nbsp;
        <asp:Button runat="server" ID="btnEnable" Text="" CssClass="button btn-show" OnClick="btnEnable_Click" />&nbsp;
        <asp:Button runat="server" ID="btnVisible" Text="" CssClass="button btn-hidden" OnClick="btnVisible_Click" />
        </td>
      </tr>
      </table>
    </div>
   <div style="margin: 10px 0px">
    <label>
      Số dòng hiển thị trên 1 trang :
    </label>
    <asp:DropDownList runat="server" ID="dropPageSize" CssClass="dropdown" AutoPostBack="true"
      OnSelectedIndexChanged="dropCountRow_SelectedIndexChanged">
      <asp:ListItem Text=" 10 " Value="10"/>
      <asp:ListItem Text=" 20 " Value="20" Selected="True" />
      <asp:ListItem Text=" 30 " Value="30" />
      <asp:ListItem Text=" 50 " Value="50" />
      <asp:ListItem Text=" 100 " Value="100" />
    </asp:DropDownList>
  </div>
    <div style="margin-top: 10px">
        <asp:Literal ID="lbThongBao" runat="server" />
    </div>
       </ContentTemplate> 
    </asp:UpdatePanel>
</asp:Content>

